<style>
    .layui-form-label{width: 250px;text-align: left;}
.layui-table-cell {overflow-x: hidden;overflow: inherit; }
.layui-table-cell{padding:2px 4px;line-height:20px;}
th span,.layui-table-cell{white-space:normal;}
</style>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend>{$sbInfo['stall_name']}的账单</legend>
    <div class="layui-inline">
      <label class="layui-form-label">账单时间:{$sbInfo['bill_time']}</label>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
          <label class="layui-form-label">应付金额:{$sbInfo['amount_money']}</label>
        </div>
        <div class="layui-inline">
          <label class="layui-form-label">补扣金额: {$sbInfo['feed_money']}</label>
        </div>
        <div class="layui-inline">
          <label class="layui-form-label">实付金额: {$sbInfo['actually_money']}</label>
        </div>
    </div>
</fieldset>
<table id="dataTable"></table>

{include file="system@block/layui" /}


<script type="text/html" id="createTimeTpl">
    <div>{{layui.util.toDateString(d.time * 1000,'yyyy-MM-dd') }}</div>
</script>
<script type="text/html" id="stallCostTpl">
    {{# for(var i in d.sfInfo.scInfo) { }}
        费用单{{parseInt(i)+1}}: {{d.sfInfo.scInfo[i]['stall_cost_type']}} / {{d.sfInfo.scInfo[i]['stall_cost_money']}}<br>
    {{# } }}
</script>
<script type="text/html" id="materialTpl">
    {{d.sfInfo.mInfo.name}}<br>
    {{d.sfInfo.mInfo.material_sku}}<br>
    {{d.sfInfo.mInfo.color}}<br>
</script>
<script type="text/html" id="toolbar">
    <div class="layui-btn-group fr">
        <form class="layui-form layui-form-pane fixed-bar-form" action="{:url('',['stall_bill_id' => $stallBillId])}" method="get" id="hisi-table-search">
            <button type="button" class="layui-btn layui-btn-primary layui-btn-sm hisi-export">导出</button>
        <form>
    </div>
</script>
<script type="text/javascript">
    layui.use(['table', 'tool'], function() {
        var table = layui.table;
        table.render({
            elem: '#dataTable'
            ,url: "{:url('', ['stall_bill_id'=>$stallBillId])}" //数据接口
            ,page: true //开启分页
            ,skin: 'row'
            ,even: true
            ,limit: 20
            ,limits: [20,50,100,150,200]
            ,text: {
                none : '暂无相关数据'
            }
            ,toolbar: '#toolbar'
            ,defaultToolbar: ['filter', 'exports', 'print']
            ,cols: [[ //表头
                 {field: 'order_time', title: '下单日期',templet: function(d){return layui.util.toDateString(d.oInfo.ordertime*1000,'yyyy-MM-dd HH:mm:ss')}, width:90}
                 ,{field: 'client_ordernum', title: '订单号',templet: function(d){return "<span class='copy-item'>"+d.sfInfo.client_ordernum+"</span>"}, width:90}
                ,{field: 'stall_name', title: '供应商', width:80}
                ,{field: 'pic', title: '材料信息',templet:'#materialTpl', width:130}
                ,{field: 'stall_order', title: '供应商单号',templet: function(d){return d.sfInfo.stall_order}, width:100}
				,{field: 'order_time', title: '供应商单日期',templet: function(d){return layui.util.toDateString(d.sfInfo.stall_order_time*1000,'yyyy-MM-dd')}, width:120}
                ,{field: 'tiaoshu', title: '采购条数', width:90}
                ,{field: 'billing_caigou_count_feed', title: '采购数量',templet: function(d){return d.sfInfo.billing_caigou_count_feed}, width:90}
                ,{field: 'caigou_unitprice', title: '采购单价',templet: function(d){return d.sfInfo.caigou_unitprice}, width:90}
				,{field: 'customer_price', title: 'MES单价',width:80}
                ,{field: 'billing_caigou_kgprice', title: '开斤公斤价',templet: function(d){return d.sfInfo.billing_caigou_kgprice}, width:80}
                ,{field: 'billing_caigou_kgcount', title: '开斤公斤数',templet: function(d){return d.sfInfo.billing_caigou_kgcount}, width:80}
				,{field: 'settle_unitprice', title: '结算单价',width:90}
                ,{field: 'settle_amount', title: '结算金额',width:90}
                ,{field: 'amount', title: '采购总金额', width:110}
				,{field: 'admin_name', title: '采购员/录入人',templet:function(d){ return d.caigou_name+"<br>"+d.admin_name;}}
			    ,{field: 'check_name', title: '初审人'}
                ,{field: 'total_amount', title: '总计'}
				,{field: 'stall_cost_money', title: '费用单/金额',templet:'#stallCostTpl',width:60}
                
            ]]
        });
    });
</script>